package com.ay.smartpark.sdk.common.base;

import java.io.InputStream;

public class DownloadFileResponse {

    public static final String SUCCESS_CODE = "SUCCESS";
    public static final String FAIL_CODE = "FAIL";
    private InputStream inputStream;
    private String code;
    private String error;

    public InputStream getInputStream() {
        return inputStream;
    }

    public void setInputStream(InputStream inputStream) {
        this.inputStream = inputStream;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public static DownloadFileResponse success(InputStream inputStream) {
        DownloadFileResponse responseBean = new DownloadFileResponse();
        responseBean.setInputStream(inputStream);
        responseBean.setCode(SUCCESS_CODE);
        responseBean.setError("");
        return responseBean;
    }

    public static DownloadFileResponse fail(String error) {
        DownloadFileResponse responseBean = new DownloadFileResponse();
        responseBean.setInputStream(null);
        responseBean.setCode(FAIL_CODE);
        responseBean.setError(error);
        return responseBean;
    }

}
